import { Injectable } from '@nestjs/common';
import { BusinessDao as Dao } from '@/servers/daos/business/business.dao';


@Injectable()
export class BusinessService {

    constructor(
        private dao: Dao
    ) { }

    /**
     * 查询所有
     */
    findAll(params: any): Promise<any> {
        return this.dao.findAll(params);
    }

    /**
     * 添加
     */
    async add(params: any): Promise<any> {
        let business = null, inwu_customer = null;
        
        if (inwu_customer.id && inwu_customer.id.id) {
            params.customer_id = inwu_customer.id.id;
            business = await this.dao.add(params);
        }
        return business;
    }

    /**
     * 修改
     * @param params 
     */
    async update(params: any): Promise<any> {
        return this.dao.update(params);
    }

    /**
     * 删除
     * @param params 
     */
    async delete(params: any): Promise<any> {
        return this.dao.delete(params.ids);
    }

}
